import React from "react";
import router from "./router";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom"

const routes = () => {
    return <>
        {router.map((item,index) => {
            return <Route key={index} path={item.path} element={<item.element></item.element>} >
                {item.children && routes(item.children)}
            </Route>
        })}
    </>
}

const Index = () => {
    return <>
        <Router>
            <Routes>
                {routes(router)}
            </Routes>
        </Router>
    </>
}

export default Index